/*
 * CourseWithTeacher.cpp
 *
 *  Created on: 13 May 2010
 *      Author: Savramis Sartios
 */

#include "CourseWithTeacher.h"
#include "../Courses/Course.h"

CourseWithTeacher::CourseWithTeacher() {
	teachers_=0;
	course_=0;
}

CourseWithTeacher::~CourseWithTeacher() {
	delete course_;
	delete teachers_;
}
CourseWithTeacher::CourseWithTeacher(const ICourse *course,const ITeacherList *teachers){
	teachers_=const_cast<ITeacherList*>(teachers);
	course_=const_cast<ICourse*>(course);
}

bool	CourseWithTeacher::setCourse(const ICourse *course){
	if(0!=course){
		course_=const_cast<ICourse*>(course);
		return true;
	}
	throw;
}

ICourse	*	CourseWithTeacher::getCourse(){
	if(0!=course_){
		return course_;
	}
	throw;
}

bool	CourseWithTeacher::addTeacher(ITeacher *teacher){
	if(0!=teacher){
		teachers_->addTeacher(teacher);
		return true;
	}
	throw;
}

bool	CourseWithTeacher::setTeachers(const ITeacherList *teachers){
	if(0!=teachers){
		teachers_=const_cast<ITeacherList*>(teachers);
		return true;
	}
	throw;
}

ITeacherIterator *	CourseWithTeacher::getTeacherIterator(){
	if(0!=teachers_){
		return teachers_->getIterator();
	}
	throw;
}
